"""
自己写的格式转换方法
"""


def dict_to_equal_str(dic: dict, link: str = ','):
    """
    获取set语句后面填写的内容, 即将字典转换为'键 = 值 ...'的格式字符串
    :return: 返回'键 = 值 ...'的格式字符串
    """
    equal_str = ''
    for key in dic.keys():
        if type(dic[key]) == str:
            equal_str = equal_str + f" {key} = '{dic[key]}' " + link
        else:
            equal_str = equal_str + f" {key} = {dic[key]} " + link
    equal_str = equal_str.rstrip(link)
    return equal_str


if __name__ == '__main__':
    d = {'ip': 2424, 'port': 1001, 'disable_domains': ''}
    print(dict_to_equal_str(d))
